﻿using System.Web.Mvc;
using Model.Content;
using Service.Content;

namespace CMS.Areas.EasyUI.Controllers
{
    /// <summary>
    /// CategoryController
    /// </summary>
    public class CategoryController : BaseController
    {
        private readonly CategoryService _categoryservice;

        /// <summary>
        /// CategoryController
        /// </summary>
        public CategoryController(CategoryService categoryservice)
        {
            _categoryservice = categoryservice;
        }

        /// <summary>
        /// GetCategoryList
        /// </summary>
        /// <returns></returns>
        [HttpPost, ValidateAntiForgeryToken]
        public JsonResult GetCategoryList()
        {
            var list = _categoryservice.GetListByObject<Category>(new { UserID =UserID, IsDelete = 0 });
            return Json(list != null ? new { code = 200, msg = list } : new { code = 401, msg = list });
        }
    }
}